{php include wl_template('common/header');}
<ul class="nav nav-tabs">
    <li class="active"><a href="#">商户会员</a></li>
</ul>
<div class="app-content">
    <div class="app-filter">
        <div class="filter-list">
            <form action="{if is_agent()}./cityagent.php{else}./index.php{/if}" method="get" class="form-horizontal" id="form1">
                {if !is_agent()}
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{MODULE_NAME}" />
                {/if}
                <input type="hidden" name="p" value="{$_W['plugin']}" />
                <input type="hidden" name="ac" value="{$_W['controller']}" />
                <input type="hidden" name="do" value="{$_W['method']}" />
                <input type="hidden" name="days" value="{$days}"/>
                <div class="form-group">
                    <label class="col-sm-2 control-label">时间</label>
                    <div class="col-sm-9 js-daterange" data-form="#form1">
                        <div class="btn-group">
                            <a href="{php echo wl_filter_url('days:6');}" class="btn {if $days == 6}btn-primary{else}btn-default{/if}">近7天</a>
                            <a href="{php echo wl_filter_url('days:29');}" class="btn {if $days == 29}btn-primary{else}btn-default{/if}">近30天</a>
                            <a href="javascript:;" class="btn js-btn-custom {if $days == -1}btn-primary{else}btn-default{/if}">自定义</a>
                        </div>
                        <span class="btn-daterange js-btn-daterange {if $days != -1}hide{/if}">
							{php echo tpl_select_time_info('stat_day', array('start' => date('Y-m-d', $starttime), 'end' => date('Y-m-d', $endtime)));}
						</span>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="panel panel-stat">
        <div class="panel-heading">
            <h3>总览</h3>
        </div>
        <div class="panel-body">
            <div class="col-md-3">
                <div class="title">
                    新增商户（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['storenew']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    总商户数
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['storenum']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    新增会员（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnew']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    总会员数
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnum']}</span>
                    </a>
                </div>
            </div>
        </div>
        <div class="panel-body">
            <div class="col-md-3">
                <div class="title">
                    付费开通会员（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnew0']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    激活码开通会员（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnew1']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    实卡开通会员（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnew2']}</span>
                    </a>
                </div>
            </div>
            <div class="col-md-3">
                <div class="title">
                    积分兑换开通会员（{$daystext}）
                </div>
                <div class="num-wrapper">
                    <a class="num" href="javascript:;">
                        <span>{$data['cardnew3']}</span>
                    </a>
                </div>
            </div>
        </div>
    </div>
    {if !is_agent()}
    <div class="app-table-list">
        <div class="table-responsive">
            <table class="table table-bordered table-hover">
                <thead class="navbar-inner">
                <tr>
                    <th>代理名称</th>
                    <th>代理地区</th>
                    <th>新增商户（{$daystext}）</th>
                    <th>总商户数</th>
                    <th>新增会员（{$daystext}）</th>
                    <th>总会员数</th>
                </tr>
                </thead>
                <tbody id="storelist">
                </tbody>
            </table>
        </div>
    </div>
    {/if}
</div>
{if !is_agent()}
<script>
    $(function(){
        $.post(location.href, function(stat){
            var data = $.parseJSON(stat);
            //表格
            var hh='';
            var lenth = data.length;
            for (var i=0;i < data.length;i++) {
                var rank = i+1;
                hh += '<tr>';
                hh += '<td><strong>'+data[i].agentname+'</strong></td>';
                hh += '<td><strong>'+data[i].areaname+'</strong></td>';
                hh += '<td><span class="text-danger">'+data[i].storenew+'</span></td>';
                hh += '<td><span class="text-danger">'+data[i].storenum+'</span></td>';
                hh += '<td><span class="text-success">'+data[i].cardnew+'</span></td>';
                hh += '<td><span class="text-success">'+data[i].cardnum+'</span></td>';
                hh += '</tr>';
            }
            $('#storelist').html(hh);
        });
    });
</script>
{/if}
{php include wl_template('common/footer');}